FROM registry.cn-hangzhou.aliyuncs.com/sn-pub/golang:1.22.1 AS builder

LABEL stage=suning

ENV CGO_ENABLED=0
ENV GOPROXY=https://goproxy.cn,direct
ENV GO111MODULE=on

WORKDIR /app

COPY . .

RUN go mod tidy

RUN go build -ldflags="-s -w" -o /app/app .


FROM registry.cn-hangzhou.aliyuncs.com/sn-pub/golang:centos7.9
ENV TZ=Asia/Shanghai

WORKDIR /app
COPY --from=builder /app/app /app/app
COPY --from=builder /app/config/config.yaml /app/config/config.yaml

RUN mkdir log
RUN mkdir log/info && mkdir log/error

CMD ["./app"]
